package 创建线程方式;

public class Method_2 implements Runnable {
    @Override
    public void run() {
        // 线程要执行的任务。
        for (int i = 1; i <= 10; i++) {
            System.out.println("子线程输出 ===》" + i);

        }
    }

    public static void main(String[] args) {
        Method_2 method2 = new Method_2();
    new Thread(method2).start();
        for (int i = 0; i < 10; i++) {
            System.out.println("主线程main输出 ===》" + i);
        }
    }
}

